package org.ls.petclinic.dao.impl;

import org.ls.petclinic.dao.VetsDao;
import org.ls.petclinic.pojo.Vets;

import java.util.List;

/**
 * @author 浪矢先生
 * @description
 * @create 2022-12-05 21:44
 */
public class VetsDaoImpl extends BaseDao implements VetsDao {

    @Override
    public List<Vets> getAll() {
        return queryForList(Vets.class,"select * from vets");
    }

    @Override
    public List<Vets> getByName(String name) {
        return queryForList(Vets.class,"select * from vets where name like ?","%"+name+"%");
    }

    @Override
    public Long add(String name) {
        Integer insert = insert("insert into vets (name) values(?)", name);
        return Long.parseLong(Integer.toString(insert));
    }
}
